<?php
// the function is used like this:
// get the date out from the mysql database and pass it to the getsign function below
$dob=$db->query("select us_dob from users where us_id=$userid");
$sign=getsign($dob);
print "nstar sign is $signn";
// this is the getsign function itself
function getsign($date){
list($year,$month,$day)=explode("-",$date);
if(($month==1 && $day>20)||($month==2 && $day<20)){
return "Aquarius";
}else if(($month==2 && $day>18 )||($month==3 && $day<21)){
return "Pisces";
}else if(($month==3 && $day>20)||($month==4 && $day<21)){
return "Aries";
}else if(($month==4 && $day>20)||($month==5 && $day<22)){
return "Taurus";
}else if(($month==5 && $day>21)||($month==6 && $day<22)){
return "Gemini";
}else if(($month==6 && $day>21)||($month==7 && $day<24)){
return "Cancer";
}else if(($month==7 && $day>23)||($month==8 && $day<24)){
return "Leo";
}else if(($month==8 && $day>23)||($month==9 && $day<24)){
return "Virgo";
}else if(($month==9 && $day>23)||($month==10 && $day<24)){
return "Libra";
}else if(($month==10 && $day>23)||($month==11 && $day<23)){
return "Scorpio";
}else if(($month==11 && $day>22)||($month==12 && $day<23)){
return "Sagittarius";
}else if(($month==12 && $day>22)||($month==1 && $day<21)){
return "Capricorn";
}
}
?>
This function doesn't use any PHP specific functions for date calculations, so it would convert easily into perl, java, C# ... etc
christo